/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * InicioForm.java
 *
 * Created on 21-sep-2010, 15:41:08
 */

package stockcontrol;

import javax.persistence.EntityManager;

/**
 *
 * @author Cott
 */
public class InicioForm extends javax.swing.JPanel {
    
    private ClienteForm clienteForm;
    private ArticuloForm articuloForm;
    private CategoriaForm categoriaForm;
    private VendedorForm vendedorForm;
    private ProveedorForm proveedorForm;

    private EntityManager entityManager;

    /** Creates new form InicioForm */
    public InicioForm(EntityManager em) {
        initComponents();
        this.entityManager = em;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jXLabel1 = new org.jdesktop.swingx.JXLabel();
        jLabel2 = new javax.swing.JLabel();
        clientesButton = new javax.swing.JButton();
        vendedoresButton = new javax.swing.JButton();
        categoriasButton = new javax.swing.JButton();
        articulosButton = new javax.swing.JButton();
        proveedoresButton = new javax.swing.JButton();

        setName("Form"); // NOI18N

        jXLabel1.setLineWrap(true);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(stockcontrol.StockControlApp.class).getContext().getResourceMap(InicioForm.class);
        jXLabel1.setText(resourceMap.getString("jXLabel1.text")); // NOI18N
        jXLabel1.setFont(resourceMap.getFont("jXLabel1.font")); // NOI18N
        jXLabel1.setName("jXLabel1"); // NOI18N

        jLabel2.setFont(resourceMap.getFont("jLabel2.font")); // NOI18N
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        clientesButton.setIcon(resourceMap.getIcon("clientesButton.icon")); // NOI18N
        clientesButton.setText(resourceMap.getString("clientesButton.text")); // NOI18N
        clientesButton.setName("clientesButton"); // NOI18N
        clientesButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clientesButtonActionPerformed(evt);
            }
        });

        vendedoresButton.setIcon(resourceMap.getIcon("vendedoresButton.icon")); // NOI18N
        vendedoresButton.setText(resourceMap.getString("vendedoresButton.text")); // NOI18N
        vendedoresButton.setName("vendedoresButton"); // NOI18N
        vendedoresButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                vendedoresButtonActionPerformed(evt);
            }
        });

        categoriasButton.setIcon(resourceMap.getIcon("categoriasButton.icon")); // NOI18N
        categoriasButton.setText(resourceMap.getString("categoriasButton.text")); // NOI18N
        categoriasButton.setName("categoriasButton"); // NOI18N
        categoriasButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                categoriasButtonActionPerformed(evt);
            }
        });

        articulosButton.setIcon(resourceMap.getIcon("articulosButton.icon")); // NOI18N
        articulosButton.setText(resourceMap.getString("articulosButton.text")); // NOI18N
        articulosButton.setName("articulosButton"); // NOI18N
        articulosButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                articulosButtonActionPerformed(evt);
            }
        });

        proveedoresButton.setIcon(resourceMap.getIcon("proveedoresButton.icon")); // NOI18N
        proveedoresButton.setText(resourceMap.getString("proveedoresButton.text")); // NOI18N
        proveedoresButton.setName("proveedoresButton"); // NOI18N
        proveedoresButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                proveedoresButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jXLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 413, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 327, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(clientesButton, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(10, 10, 10)
                        .addComponent(vendedoresButton, javax.swing.GroupLayout.PREFERRED_SIZE, 208, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(articulosButton, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(categoriasButton, javax.swing.GroupLayout.PREFERRED_SIZE, 208, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(proveedoresButton, javax.swing.GroupLayout.PREFERRED_SIZE, 413, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jXLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(6, 6, 6)
                .addComponent(jLabel2)
                .addGap(22, 22, 22)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(clientesButton)
                    .addComponent(vendedoresButton))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(articulosButton)
                    .addComponent(categoriasButton))
                .addGap(18, 18, 18)
                .addComponent(proveedoresButton)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void clientesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clientesButtonActionPerformed
        clienteForm = new ClienteForm((VentaForm)null, entityManager);
        clienteForm.showFrame();
}//GEN-LAST:event_clientesButtonActionPerformed

    private void vendedoresButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_vendedoresButtonActionPerformed
        vendedorForm = new VendedorForm((VentaForm)null,entityManager);
        vendedorForm.showFrame();
}//GEN-LAST:event_vendedoresButtonActionPerformed

    private void categoriasButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_categoriasButtonActionPerformed
        categoriaForm = new CategoriaForm((CompraForm)null, entityManager);
        categoriaForm.showFrame();
}//GEN-LAST:event_categoriasButtonActionPerformed

    private void articulosButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_articulosButtonActionPerformed
        articuloForm = new ArticuloForm((VentaForm)null,entityManager);
        articuloForm.showFrame();
}//GEN-LAST:event_articulosButtonActionPerformed

    private void proveedoresButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_proveedoresButtonActionPerformed
        proveedorForm = new ProveedorForm((CompraForm)null,entityManager);
        proveedorForm.showFrame();
}//GEN-LAST:event_proveedoresButtonActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton articulosButton;
    private javax.swing.JButton categoriasButton;
    private javax.swing.JButton clientesButton;
    private javax.swing.JLabel jLabel2;
    private org.jdesktop.swingx.JXLabel jXLabel1;
    private javax.swing.JButton proveedoresButton;
    private javax.swing.JButton vendedoresButton;
    // End of variables declaration//GEN-END:variables

}
